<template>
  <div class="Board">
    <Square
      v-for="(item, index) of list"
      :key="index"
      :index="index"
      :text="item"
      :nextPlayerIsX="nextPlayerIsX"
      :class="{ red : line.includes(index) }"
      @getIndex="getIndex"
    />
  </div>
</template>

<script>
import Square from "./Square.vue";
export default {
  name: "Board",
  components: {
    Square,
  },
  props: {
    nextPlayerIsX: {
      type: Boolean,
      required: true
    },
    list: {
      type: Array,
      required: true
    },
    line: {
      type: Array,
      default: []
    }
  },
  data() {
    return {
    }
  },
  methods: {
    getIndex(index) {
      this.$emit("getIndex", index)
    }
  }
}
</script>

<style scoped>
.Board {
  width: 300px;
  display: flex;
  flex-wrap: wrap;
}

.red {
  background-color: red;
}
</style>
